package com.sky.mapper;

import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {
    /**
     * 添加购物车--条件查询（判断是否在购物车中）
     * @param shoppingCart
     * @return
     */
    List<ShoppingCart> list(ShoppingCart shoppingCart);

    /**
     * 添加购物车--修改数量（商品存在的话，商品数量＋）
     * @param shoppingCart
     */
    void updateNumberById(ShoppingCart shoppingCart);

    /**
     * 添加购物车
     * @param shoppingCart
     */
    void insert(ShoppingCart shoppingCart);

    /**
     * 清空购物车
     * @param
     */
    void deleteCart(ShoppingCart shoppingCart);


    /**
     * 删除一个
     * @param
     */
    void deleteOneCart(Long id);


    void insertBatch(List<ShoppingCart> cartList);


    ShoppingCart selectCart(ShoppingCart shoppingCart);

    @Delete("delete from shopping_cart where id=#{userId}")
    void deleteByUserId(Long userId);
}
